package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-08-30
 */
@RestController
@RequestMapping("/likeds")
@RequiredArgsConstructor
public class LikedRecordController {
    private final ILikedRecordService likedRecordService;

    @PostMapping
    @ApiOperation("点赞/取消点赞")
    public void likedRecord(@RequestBody LikeRecordFormDTO dto) {
        likedRecordService.likedRecord(dto);
    }

    @GetMapping("/list")
    @ApiOperation("批量查询点赞记录")
    public Set<Long> queryLiked(@RequestParam("bizIds") List<Long> bizIds){
        return likedRecordService.queryLikedTimes(bizIds);
    }

    public void deleteLiked(Long id){
        likedRecordService.deleteLiked(id);
    }
}
